home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / cli / mx2src.arc / SYSCALL.DEF < prev    next >
Text File  |  1989-01-05  |  4KB  |  114 lines

  1.  
  2. (*              Copyright 1987 fred brooks LogicTek             *)
  3. (*                                                              *)
  4. (*                                                              *)
  5. (*   First Release                      12/8/87-FGB             *)
  6. (* Add ProcessPid to return PID of calling process              *)
  7. (*                                      12/12/87-FGB            *)
  8. (* Added variable parm to StartProcess to pass info to process  *)
  9. (* in currentprocess.gemsave[15]        1/1/88-FGB              *)
  10. (*                                                              *)
  11.  
  12. DEFINITION MODULE SYSCALL;
  13.  
  14. FROM    ATOMIC  IMPORT  SIGNAL,sysvariable;
  15. FROM    SYSTEM  IMPORT  ADDRESS;
  16. FROM    Strings IMPORT  String;
  17.  
  18. CONST   (* SYSTEM ERRORS *)
  19.  
  20.         ENOERR           =       0;     (* no error *)
  21.         ENOENT           =       2;     (* no file or directory *)
  22.         ENORCH           =       3;     (* no such process *)
  23.         ENOMEM           =       12;    (* out of memory *)
  24.         EBADRQC          =       54;    (* bad request *)
  25.  
  26. (* Read the program command line and pass it to kernel to execute *)
  27. PROCEDURE   SysCmd;
  28.  
  29. (* Pass command line to kernal to execute *)
  30. PROCEDURE   SysReq(VAR command: ARRAY OF CHAR);
  31.  
  32. (* Get the processdescriptor for the currentprocess *)
  33. PROCEDURE  SysDes(VAR currentprocess : SIGNAL);
  34.  
  35. (* Get the systemvariables ,These are copies of the variables *)
  36. PROCEDURE  SysVar(VAR sysvar : sysvariable);
  37.  
  38. (* Return PID of calling process *)
  39. PROCEDURE  ProcessPid(): INTEGER;
  40.  
  41. (* Put procedure to sleep *)
  42. PROCEDURE        Sleep;
  43.  
  44. (* check to see if special interrupt has happened , execute if triggered *)
  45. PROCEDURE CheckSpint;
  46.  
  47. (*  Setup spint linkage to spintid *)
  48. PROCEDURE EnableSpint(spintid: CARDINAL; routine: PROC; data: ADDRESS): BOOLEAN;
  49.  
  50. (*  request spint data and active info  return TRUE if active bit set *)
  51. (*  data will be set to NIL if the spint is disabled           *)
  52. PROCEDURE SpintInfo(spintid: CARDINAL; VAR data: ADDRESS): BOOLEAN;
  53.  
  54. (*  remove spint linkage to spintid *)
  55. PROCEDURE DisableSpint(spintid: CARDINAL);
  56.  
  57. (*  send spint to routine  *)
  58. PROCEDURE Trigger(spintid: CARDINAL): BOOLEAN;
  59.  
  60. (*  Hold program interrupts *)
  61. PROCEDURE HoldSpint(spintid: CARDINAL);
  62.  
  63. (*  Release program interrupts *)
  64. PROCEDURE ReleaseSpint(spintid: CARDINAL);
  65.  
  66. (*  Wait a specified period of time for a program interrupt ticks are
  67.     in 200 hz clocks. If tick is -1 then wait forever for interrupt  *)
  68. PROCEDURE IntDelay(tick: LONGINT): INTEGER;
  69.  
  70. (* create a process for the MX2 system, place in the scheduler ready
  71.    list, start new process *)
  72. PROCEDURE StartProcess(VAR P: PROC; 
  73.                        VAR n: LONGCARD; 
  74.                        VAR priority: INTEGER; 
  75.                        VAR pn: String;
  76.                        VAR parm: ADDRESS);
  77.  
  78. (* store the currentprocess and switch to next process in ready list *)
  79. PROCEDURE SwapProcess;
  80.  
  81. (* end process and remove it from the ready list, free memory used by
  82.    process *)
  83. PROCEDURE TermProcess(VAR id: INTEGER);
  84.  
  85. (* return the next pid the system will use for a new process *)
  86. PROCEDURE NextPid(): INTEGER;
  87.  
  88. (* tell scheduler not to run this process but keep in memory *)
  89. PROCEDURE SleepProcess(VAR id: INTEGER);
  90.  
  91. (* tell scheduler tp sleep for msec 1000th of a second  *)
  92. PROCEDURE DozeProcess(VAR id: INTEGER; VAR msec: LONGCARD);
  93.  
  94. (* Sleep process until the contents of 'loc' equals 'value AND mask'.
  95. msec is the timeout value in milliseconds if set the 0 it waits forever *)
  96. PROCEDURE WaitProcess(VAR id: INTEGER; VAR loc: ADDRESS;
  97.                       VAR value,mask,msec: LONGCARD);
  98.  
  99. (* tell scheduler to start running this process again if it was sleeping
  100.    before *)
  101. PROCEDURE WakeupProcess(VAR id: INTEGER);
  102.  
  103. (* change process priority *)
  104. PROCEDURE ChangeProcessPriority(VAR id: INTEGER; VAR pri: INTEGER);
  105.  
  106. (* turn on the scheduler interrupt, and start normal process switching *)
  107. PROCEDURE MultiBegin;
  108.  
  109. (* turn off the scheduler interrupt, used to stop process switching in
  110.    section of code that should not be swapped out *)
  111. PROCEDURE MultiEnd;
  112.  
  113. END               SYSCALL.
  114.